﻿@model PokerLife.Models.LIS.CountryViewModel
@{
    ViewBag.Title = "AddEdit";
    Layout = "~/Views/Shared/_LayoutBlank.cshtml";
}

@Html.HiddenFor(p => p.IDSys)

<div class="f_row">
    <div class="f_lable">
        @Html.LabelFor(p => p.CountryID)
    </div>
    <div class="f_editor">
        @Html.TextBoxFor(p => p.CountryID, new { style = "width:300px;height:22px" })
        @Html.ValidationMessageFor(p => p.CountryID)
    </div>
</div>

<div class="f_row">
    <div class="f_lable">
        @Html.LabelFor(p => p.CountryName)
    </div>
    <div class="f_editor">
        @Html.TextBoxFor(p => p.CountryName, new { style = "width:300px;height:22px" })
        @Html.ValidationMessageFor(p => p.CountryName)
    </div>
</div>

<div class="f_row">
    <div class="f_lable">
        @Html.LabelFor(p => p.AbbreviationName)
    </div>
    <div class="f_editor">
        @Html.TextBoxFor(p => p.AbbreviationName, new { style = "width:300px;height:22px" })
    </div>
</div>

<div class="f_row">
    <div class="f_lable">
        @Html.LabelFor(p => p.Note)
    </div>
    <div class="f_editor">
        @Html.TextAreaFor(p => p.Note, new { style = "width:300px;height:44px" })
    </div>
</div>


<div class="f_row">
    <div style="float: right">
        <input id="btnSave" class="k-button toolbarbuttonsize" type="button" value="Save" />
        <input id="btnExit" class="k-button toolbarbuttonsize" type="button" value="Exit" />
    </div>
</div>


<style>
    .f_row {
        clear: both;
        float: left;
        width: 90%;
        padding-left: 20px;
        padding-top: 5px;
    }

    .f_lable {
        float: left;
        width: 25%;
    }

    .f_editor {
        float: left;
        width: 75%;
    }
</style>

<script>

    $("#btnSave").click(function (e) {
        e.preventDefault();

        var country = {};
        country.CountryID = $("#CountryID").val();
        country.CountryName = $("#CountryName").val();
        country.Note = $("#Note").val();
        $.ajax({
            url: '@Url.Content("~/Country/AddEdit")',
            type: 'POST',
            dataType: 'json',
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(country),
            traditional: true,
            success: function (result) {
                kendo.ui.ExtAlertDialog.show({ title: "Thông báo!", message: result.Message });
            },
            error: function (event, request, settings) {
                alert(settings);
            }
        });

    });

    $("#btnExit").click(function (e) {
        e.preventDefault();
        window.parent.$("#window").data("kendoWindow").close();
    });

</script>
